package com.snake.springboot.custom.service.config;

import org.snake.common.security.account.SnakeInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Value("${snake.springboot.jwtauth.header-key-of-account-info:account-info}")
    private String loginUserHeader;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new SnakeInterceptor(loginUserHeader))
                //拦截的路径
                .addPathPatterns("/**");
    }
}
